#pragma once
#include ".\fontmng.h"

CFontMng::CFontMng(void)
{
	SAFE_ZERO( m_pFont );
}

CFontMng::~CFontMng(void)
{
	SAFE_ZERO( m_pFont );
}

bool CFontMng::Init()
{
    HDC hDC = GetDC( NULL );

    int nHeight = -( MulDiv( 10 , GetDeviceCaps( hDC , LOGPIXELSY ) , 72 ) );

	ReleaseDC( NULL , hDC );

	if( FAILED( D3DXCreateFont( g_pd3dDevice , nHeight , 0 , FW_BOLD , 0 , FALSE , DEFAULT_CHARSET , OUT_DEFAULT_PRECIS ,
								DEFAULT_QUALITY , DEFAULT_PITCH | FF_DONTCARE , TEXT("Arial") , &m_pFont ) ) )
	{
		OutputDebugString( "Create Font failed! , CFontMng" );
        return FALSE;
	}

	return TRUE;
}

bool CFontMng::Release()
{
	m_pFont->Release();

	return TRUE;
}

bool CFontMng::Render( RECT rc , char *Str )
{
	m_pFont->DrawText( NULL , Str , -1 , &rc , DT_NOCLIP , D3DXCOLOR( 1.0f , 0.0f , 0.0f , 1.0f ) );
	return TRUE;
}